package com.ky.gp.app.controller;


import cn.hutool.core.convert.NumberWithFormat;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ky.common.config.SystemConfig;
import com.ky.common.util.JwtUtil;
import com.ky.common.vo.R;
import com.ky.gp.app.service.ReviewFeign;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * <p>
 * 评论 前端控制器
 * </p>
 *
 * @author wgz
 * @since 2024-06-17
 */
@RestController
@RequestMapping("/api")
public class ReviewController {
    @Autowired
    ReviewFeign reviewFeign;
    @RequestMapping(method = RequestMethod.POST, value = "/study/review/comment")
    public R comment(@RequestParam("articleId") Integer articleId, @RequestParam("comment") String commentContent){
        return R.ok(reviewFeign.comment(articleId, commentContent));
    }
    //查找评论
    @RequestMapping("/study/review/findAll/{articleId}")
    public R findAll(@PathVariable("articleId") Integer articleId){

        return R.ok(reviewFeign.findAll(articleId));
    }


    @RequestMapping("/study/review/findProblem")
    public R findProblem(@RequestParam("problemId") Integer problemId){
        return R.ok(reviewFeign.findProblem(problemId));
    }


    @RequestMapping(method = RequestMethod.POST,value = "/study/review/commentProblem")
    public R commentProblem(@RequestParam("problemId") Integer problemId, @RequestParam("content") String comment){
        return R.ok(reviewFeign.commentProblem(problemId, comment));
    }


    @RequestMapping("/study/review/findCircle")
    public R findCircle(@RequestParam("circleArticleId") Integer circleArticleId){
        return R.ok(reviewFeign.findCircle(circleArticleId));
    }


    @RequestMapping(method = RequestMethod.POST,value = "/study/review/commentCircle")
    public R commentCircle(@RequestParam("circleArticleId") Integer circleArticleId, @RequestParam("content") String comment){
        return R.ok(reviewFeign.commentCircle(circleArticleId, comment));

    }
}

